using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

//UI Ctrl层: UI_Battle
public class UI_Battle : UGUICtrl
{
    public UI_Battle_View selfView;

    public UI_Battle()
    {
        OnCreate(ref selfView,"UGUI/ui_battle","UI_Battle");
    }

    /// <summary>
    /// 按钮添加事件
    /// </summary>
    protected override void ButtonAddClick()
    {
        //------------------按钮添加事件-----------------
        selfView.btn_quit.onClick.AddListener(() =>
        {
            Game.GetComp<UNetworkManager>().Quit();
            
            Game.UI.CloseUI<UI_Shot>();
            Game.UI.CloseUI<UI_Hurt>();
            Game.UI.CloseUI<UI_Battle>();
            Game.UI.OpenUIPanel<UI_Room>();
        });
    }

    /// <summary>
    /// 打开面板
    /// </summary>
    public override void OpenPanel(object data)
    {
        base.OpenPanel(data);

    }

    public void SetBulletNum(int num, int maxNum)
    {
        selfView.text_bulletNum.text = num + "/" + maxNum;
    }
}